// pages/myActivities/myActivityDetail.js
var $=require('../util/commit.js');
Page({
  /**
   * 页面的初始数据
   */
  data: {
    param:'',
    HDData:{
      id:1,
      url:'https://app.xingxue.vip/image1_1/group-buying_icon21.png',
      name:'橙风破浪',
      status:1,
      title:'南邮游街示众活动',
      startTime:'09月-18日12:29',
      endTime:'09月-29日12：29',
      address:'南京西夏区街道28号',
      skillType:'线下k歌',
      fy:'免费',
      money:'9.00',
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that=this;
    let param=JSON.parse(options.data);
    that.setData({
      param,
    });
    that.loadData();
  },
  loadData:function(e){
    let that=this;
    $.POST({
      url:'caSSUD',
      data:{
        cuid: that.data.param.id,
      }
    },function(e){
      that.setData({
        HDData:e.data
      })
    },function(e){}
    )
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  callPhone:function(e){
    wx.makePhoneCall({
      phoneNumber: e.currentTarget.dataset.phone,
    })
  },
  finish:function(e){
    let that = this;
    $.POST({
      url: 'caCC',
      data: {
        caid: e.currentTarget.dataset.caid,
        cuid: that.data.param.id,
      }
    }, function (e) {
      wx.showToast({
        title: e.msg,
        icon: 'none'
      });
      that.loadData();
    }, function (e) { console.log(e) })
  },
  cancle:function(e){
    let that=this;
    $.POST({
      url:'caCCSU',
      data:{
        cuid: that.data.param.id,
      }
    },function(e){
      wx.showToast({
        title: e.msg,
        icon:'none'
      });
      that.loadData();
    },function(e){console.log(e)})
  }
})